'use strict';

const baseController =require('./baseController.js');

class manageController extends baseController {
    async list() {
        let {service, request, query} = this.ctx;
        let jsonData={}
        let listResult=await service.mannagerService.list(jsonData);
        this.success({data:{list:listResult}})
    }
    async doAdd() {
        let {service, request, query} = this.ctx;
        let jsonData=this.ctx.request.body;
        let doAddResult = await service.mannagerService.doAdd(jsonData);

        if(doAddResult){
            this.success({message:"增加用户成功"})
        }else{
            this.error({message:"用户名已存在"})
        }
    }
    async getRole(){
        let {service, request, query} = this.ctx;
        let newVar = await service.roleService.list({});
        this.success({data:{role:newVar}})
    }
}

module.exports = manageController;

//router.get('/admin/manageController/index',controller.admin.manageController.index);
